#include "aggregationbutton.h"

AggregationButton::AggregationButton(QGraphicsObject *parent) : AssociationButton(parent)
{
    QMatrix m;
    m.rotate(90);
    m.scale(.4, .6);

    this->_decorator.setPen(this->_pen);
    this->_decorator.setPolygon( m.map(AggregationDecorator()));
    this->_decorator.setPos(10, 2);
    this->addToGroup(&this->_decorator);
}

AggregationButton::~AggregationButton()
{
    qDebug() << "deleting AggregationButton";
}

DraggedRelation* AggregationButton::draggedRelation()
{
    DraggedRelation *draggedRelation = new DraggedRelation();
    draggedRelation->setStartItem(this->_relationalItem);

    UmlRelation *relation = new UmlRelation();
    relation->setRelationType(UmlRelation::UmlAggregationRelationType);

    return draggedRelation;
}
